<!doctype html>
<html ng-app="base">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../build/common/base.css" rel="stylesheet">
<script type="text/javascript" src="../../build/common/base.js"></script>
<script type="text/javascript" src="../../build/common/ngEdit.js"></script>
<script type="text/javascript">
	var Controller = [ '$scope', 'baseService', function(scope, baseService) {
		var instanceId = $.getParam("instanceId")
		if (!instanceId) {
			instanceId = window.passData.instanceId;
		}
		var defer = baseService.postForm(__ctx + "/bpm/instance/getInstanceOpinion", {
			instId : instanceId
		});
		$.getResultData(defer, function(data) {
			scope.opinionList = data;
		})

		ToolsController.getEnum("com.dstz.bpm.api.constant.OpinionStatus").then(function(data) {
			scope.OpinionStatus = data;
			scope.OpinionStatusKeyMap = {};
			angular.forEach(data, function(val, key) {
				scope.OpinionStatusKeyMap[val.key] = val.value;
			});
		});
		
		scope.assignInfo = function(info){
			if(!info){
				return "";
			}
			
			var msg = "";
			angular.forEach(info.split(","),function(item){
				if(!item){
					return;
				}
				if(msg){
					msg+=",";
				}
				var strs = item.split("-");
				if(strs[0]==="user"){
					msg="[用户]";
				}else if(strs[0]==="role"){
					msg="[角色]";
				}else if(strs[0]==="group"){
					msg="[组]";
				}else if(strs[0]==="org"){
					msg="[组织]";
				}else if(strs[0]==="post"){
					msg="[岗位]";
				}else if(strs[0]==="job"){
					msg="[职称]";
				}
				msg = msg + strs[1];
			});
			return msg;
		};
	} ];

	function isValidate() {
		$.Dialog.close(window);
		return false;
	}
</script>
</head>
<body class="panel success" ng-controller="Controller">
	<table class="form-table" style="margin-top: 5px">
		<tdead>
		<tr>
			<td></td>
			<td style="widtd: 10%; min-widtd: 150px;">任务名称</td>
			<td style="widtd: 10%; min-widtd: 130px;">任务创建时间</td>
			<td style="widtd: 10%; min-widtd: 130px;">处理时间</td>
			<td style="widtd: 30%;">待执行人</td>
			<td style="widtd: 10%; min-widtd: 55px;">执行人</td>
			<td style="widtd: 10%; min-widtd: 63px;">处理状态</td>
			<td style="widtd: 12%; min-widtd: 130px;">备注/意见</td>
		</tr>
		</tdead>
		<tr ng-repeat="o in opinionList">
			<td style="widtd: 26px;">{{$index+1}}</td>
			<td style="widtd: 10%; min-widtd: 150px;">{{o.taskName}}</td>
			<td style="widtd: 10%; min-widtd: 130px;">{{o.createTime | date:"yyyy-MM-dd HH:mm:ss"}}</td>
			<td style="widtd: 10%; min-widtd: 130px;">{{o.approveTime | date:"yyyy-MM-dd HH:mm:ss"}}</td>
			<td style="widtd: 30%;">{{assignInfo(o.assignInfo)}}</td>
			<td style="widtd: 10%; min-widtd: 55px;">{{o.approverName}}</td>
			<td style="widtd: 10%; min-widtd: 63px;">{{OpinionStatusKeyMap[o.status]}}</td>
			<td style="widtd: 12%; min-widtd: 130px;">{{o.opinion}}</td>
		</tr>
	</table>
</body>
</html>